﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LogException.Dominio.Repositorios;
using System.Configuration;

namespace LogException.Dominio
{
    public class LogMantis
    {
        IMantis _repositorioMantis;
        string _usuarioMantis = ConfigurationManager.AppSettings["usuarioMantis"].ToString();
        string _senhaMantis =   ConfigurationManager.AppSettings["senhaMantis"].ToString();


        public LogMantis(IMantis repositorioMantis) 
        {
            _repositorioMantis = repositorioMantis;
        }

        public long GravaLogMantis(Exception ex) 
        {
            
            if (String.IsNullOrEmpty(_repositorioMantis.Echo()))
                return -1;
            MantisService.IssueData issue = new MantisService.IssueData();

           return  long.Parse(_repositorioMantis.AdicionaLog(_usuarioMantis, _senhaMantis, issue));
        
        }

    }
}
